put "bkgnd field 1 of card" && thisCard & "," after toPrint
end repeat
delete last char of toPrint
pop card
textstream toPrint,8,10,5,4
set lockscreen to false
end mouseUp
-- part contents for background part 16
----- text -----
TEXTSTREAM XCMD version 1.2
Kevin Calhoun
ABOUT TEXTSTREAM
The TextStream XCMD allows you to print the contents of a container using your printer's built-in font. You can print the contents of just one container at a time or of several at once. You have the option of telling TextStream how many characters wide you want your left and right margins to be and how many lines tall you want your top and bottom margins to be.
In case of an error, TextStream returns an error message as the Result. Word 1 of this message will be "Error."
TextStream works with both the LaserWriter and the ImageWriter.
Parameters given inside the brackets, such as <notNeeded>, are optional.
The containerList is a list of containers to be printed, and may include fields. Anything you can "get" and "put" you can print, such as "background field 3 of card 2" or even "the userlevel."
If you don't include the optional information for margins (or if you give unreasonable numbers for margins), TextStream will default to 96 chars per line and 63 lines per page, which is as much as either the LaserWriter or the ImageWriter can fit on a page, and which produces somewhat crowded-looking copy.
SETTING MARGINS
The parameters leftMargin and rightMargin are the numbers of characters to skip at the start and the end of each line. The parameters topMargin and bottomMargin are the numbers of lines to skip at the top and the bottom of each page. A leftMargin of 8, a rightMargin of 10, a topMargin of 4, and a bottomMargin of 4 will produce clean-looking copy.
Valid examples--
TextStream "bkgnd field 1",8,10 --only left and right margins specified
TextStream "containerFoo","","",5,5 --only top and bottom margins specified
TextStream "card field Philately" --no margin settings
TextStream "card field id 4 of card 2, card field id 3 of card 5, bkgnd field 1" --multiple
--containers
TextStream "field 1",8,10,4,4 --these are the settings I prefer for the margins
See the script of the button below for an example.
It is possible to put the designation of containers to print into a variable and then pass the variable to TextStream, as follows…
on openField
if the optionKey is down then
put the name of the target into theName
put the id of the target into theField
if word 1 of theName is "card" then
put "card field id " before theField
else put "field id " before theField
TextStream theField,8,10,5,5
end if
end openField
This handler prints a field using TextStream if the field is clicked while the option key is down.
CHANGE HISTORY
7 March 1988 -- 1.0
7 April 1988 -- 1.2 Prints any container, not just fields.